<?php
	/*
	$b = "ka"; 
//	$b = array(); 
	$a = &$b; 
	
	var_dump(is_ref([$a])); 
	var_dump(is_ref([$b])); 
	exit; 
	$a = array("xuj", array(1)); 
	var_dump(Evilworlds\local_cache_set("lal", $a)); $a[0] = NULL; 
	var_dump(Evilworlds\local_cache_exists("lal")); 
	Evilworlds\local_cache_get("lal"); 
	//var_dump(Evilworlds\local_cache_delete("lal")); 
	
	//var_dump(Evilworlds\local_cache_get("lal")); 
	
	//var_dump(Evilworlds\local_cache_exists("lal")); 
	
	echo "\n\n\n"; 
	
	exit; 
	$text_ptr = " 
		Ссылки: 
			http://spaces.ru
			http://spaces.ru/journal/?filter=4&jsort=2&link_id=751286
			https://www.google.com.ua/search?q=svfdgdsg&aq=f&oq=svfdgdsg&aqs=chrome.0.57j59j57j60j59j60.876j0&sourceid=chrome&ie=UTF-8
			[url=http://spaces.ru/journal/?filter=4&jsort=2&link_id=751286]lalala[/url]
			[url=https://spaces.ru/journal/?filter=4&jsort=2&link_id=751286]lalala[/url]
		
		Декорация: 
			[b]bold[/b]
			[i]italic[/i]
			[s]Strike[/s]
			[u]underline[/u]
			[color=red]red text[/color]
			[bgcolor=red]red background[/bgcolor]
		
		Вложенные: 
			[bgcolor=red]
				[color=blue]
					[b][i][s][u]OLOLOL http://spaces.ru
						[url=http://spaces.ru/journal/?filter=4&jsort=2&link_id=751286]lalala[/url]
					 OLOLO[/u][/s][/i][/b]
				[/color]
			[/bgcolor]
		
		Кривые: 
			[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[b]]]]]]]]]]]]]]bold[[[[[[[[[[[[[[[[[[[[[[[[[[[[[/b]]]]]]]]]]]]]]]]]]]]]]]]]
			[/i][i]italic[/i][/i][/i][/i][/i][/i][/i]
			[bgcolor=[s][/s]]red background[/bgcolor]
		@lalala :ЛОЛ :лол :lol
	"; 
	// olololo o_O
	$text = $text_ptr; 
//	for ($i = 0; $i < 200; $i++)
//		$text .= $text_ptr; 
//	echo "Trololo len: ".strlen($text)."\n"; 
	
	$time = microtime(true); 
	
	printf("Time used: %f\n", microtime(true) - $time); 
	
	$time = microtime(true); 
	$t = new Evilworlds\Text\Preprocessor(); 
	
	$t -> setText($text); 
	//$t -> setHomeUrl("http://spaces.ru"); 
	//$t -> setRedirectUrl("http://spaces.ru/?url="); 
	$t -> analize(); 
	$t -> prepare(); 
	echo $t -> getText(); 
	$t -> free(); 
	printf("Time used: %f\n", microtime(true) - $time); 
	
	
	exit; 
	
	
	var_dump(\Evilworlds\Mysql::getInstance() -> setLoggingQueries(1)); 
	
	\Evilworlds\Mysql::getInstance() -> connect("127.0.0.1", "root", "qwerty", "test", 0, true, 0); 
	
	
	\Evilworlds\Mysql::getInstance() -> transaction(
		function () { echo 'LAL'; throw new Exception; return true; }
	); 
	echo 'aa'; 
	//var_dump(\Evilworlds\Mysql::getInstance() -> getQueriesList()); 
	
	exit; 
	$db  = new \Evilworlds\Mysql; 
	$db2 = new \Evilworlds\Mysql; 
	try {
		var_dump($db -> connect("127.0.0.1", "root", "qwerty", "test", 0, true, 0)); 
		var_dump($db -> ping()); 
		
		var_dump($db2 -> connect("127.0.0.1", "root", "qwerty", "test", 0, true, 0)); 
		var_dump($db2 -> ping()); 
	} catch (Exception $e) {
		echo $e -> getMessage()."\n"; 
	}
	echo "...\n"; 
	
	var_dump($db2 -> escape("lal\'")); 
	var_dump($db -> prepare(
		"%s %d %f %u %b\n".
		"%s %d %f %u %b\n".
		"%as %ad", 
		"СТРОКА ЛАЛАЛА", 100500, 6.88, -90, 99, 
		"СТРОКА ЛАЛАЛА", 100500.6, "6.88", "-90", 99, 
		array("", "2"), [3,-3,999999999999999999999999999999]
	)); 
	
	$db -> setLoggingQueries(true); 
	$res = $db -> query("SHOW FIELDS FROM evilworlds.users"); 
	var_dump($res); 
	var_dump($db -> fetchAll($res)); 
	
	exit; 
	
	define('DEBUG', true); 
	define('W', '/var/www/zhumarin-test.ru/'); 
	require_once W.'core/init.php'; 
	
	use \Evilworlds\Debug; 
	use \Evilworlds\Router; 
	use \Evilworlds\Registry; 
	use \Evilworlds\Router\NotFoundException; 
	
	ob_start(); 
	Debug\Profiler::start('evilworlds_route', 'Route'); 
	$router = new Router; 
	try {
		try {
			$router -> prepare(array_var($_GET, '__route_url', '')); 
			$router -> execute(array_var($_GET, 'q', '')); 
		} catch (NotFoundException $e) {
			$site_config = \Evilworlds\Config::get("common", "site"); 
			$router -> prepare($site_config['error_url']); 
			$router -> execute($site_config['error_route']); 
		}
	} catch (Exception $e) {
		echo $e -> getMessage()."\n"; 
	}
	ob_get_clean(); 
	*/
	/*
	try {
		echo \Evilworlds\Text\Url::get("Admin") -> getUrl()."\n"; 
	} catch (ErrorException $e) {
		die($e -> getMessage()); 
	}	
	
	exit; 
	$u = new \Evilworlds\Text\Url; 
	$u -> setModule("User"); 
	echo $u -> getUrl()."\n"; 
	
	$u -> parse("http://spaces.ru:80/friends/?r=friends/index&r=1&link_id=1547422&name=Zhumarin&sort=2"); 
	
	echo $u."\n"; // $u -> r = "azaza"; 
	unset($u -> r); 
	$u["host"] = "spaces.su"; 
	
	var_dump($u["query"]); 
	$u -> addQueryValues(array("a" => "b", "c" => "d")); 
	echo $u -> getUrl("&")."\n"; 
	
	exit; */
	/*$text_ptr = " 
		Ссылки: 
			http://spaces.ru
			http://spaces.ru/journal/?filter=4&jsort=2&link_id=751286
			https://www.google.com.ua/search?q=svfdgdsg&aq=f&oq=svfdgdsg&aqs=chrome.0.57j59j57j60j59j60.876j0&sourceid=chrome&ie=UTF-8
			[url=http://spaces.ru/journal/?filter=4&jsort=2&link_id=751286]lalala[/url]
			[url=https://spaces.ru/journal/?filter=4&jsort=2&link_id=751286]lalala[/url]
		
		Декорация: 
			[b]bold[/b]
			[i]italic[/i]
			[s]Strike[/s]
			[u]underline[/u]
			[color=red]red text[/color]
			[bgcolor=red]red background[/bgcolor]
		
		Вложенные: 
			[bgcolor=red]
				[color=blue]
					[b][i][s][u]OLOLOL http://spaces.ru
						[url=http://spaces.ru/journal/?filter=4&jsort=2&link_id=751286]lalala[/url]
					 OLOLO[/u][/s][/i][/b]
				[/color]
			[/bgcolor]
		
		Кривые: 
			[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[b]]]]]]]]]]]]]]bold[[[[[[[[[[[[[[[[[[[[[[[[[[[[[/b]]]]]]]]]]]]]]]]]]]]]]]]]
			[/i][i]italic[/i][/i][/i][/i][/i][/i][/i]
			[bgcolor=[s][/s]]red background[/bgcolor]
		@lalala :ЛОЛ :лол :lol
	"; 
	// olololo o_O
	$text = $text_ptr; 
//	for ($i = 0; $i < 200; $i++)
//		$text .= $text_ptr; 
//	echo "Trololo len: ".strlen($text)."\n"; 
	
	$time = microtime(true); 
	
	printf("Time used: %f\n", microtime(true) - $time); 
	
	$time = microtime(true); 
	$t = new Evilworlds\Text\Preprocessor(); 
	
	$t -> setText($text); 
	//$t -> setHomeUrl("http://spaces.ru"); 
	//$t -> setRedirectUrl("http://spaces.ru/?url="); 
	$t -> analize(); 
	$t -> prepare(); 
	echo $t -> getText(); 
	$t -> free(); 
	printf("Time used: %f\n", microtime(true) - $time); 
	
*/
